package com.emm.yixun.customer.service;

import java.util.List;
import java.util.Map;

import javax.jws.WebService;

import com.emm.yixun.common.app.AddContactWayResDto;
import com.emm.yixun.common.app.AddCustomerReqDto;
import com.emm.yixun.common.app.AddCustomerResDto;
import com.emm.yixun.common.app.AddFollowReqDto;
import com.emm.yixun.common.app.AddFollowResDto;
import com.emm.yixun.common.app.DistributionConsultantReqDto;
import com.emm.yixun.common.app.DistributionConsultantResDto;
import com.emm.yixun.common.app.base.CommonResDTO;
import com.emm.yixun.common.model.BusinessRelation;
import com.emm.yixun.common.model.Customer;
import com.emm.yixun.common.model.Image;
import com.emm.yixun.common.model.Project;
import com.emm.yixun.common.model.User;
import com.emm.yixun.common.model.dto.BusinessRelationDto;
import com.emm.yixun.common.model.dto.ContactWayDto;
import com.emm.yixun.common.model.dto.CustomerComponentDto;
import com.emm.yixun.common.model.dto.CustomerDto;
import com.emm.yixun.common.model.dto.CustomerInfo;
import com.emm.yixun.common.model.dto.HighchartsDto;
import com.emm.yixun.common.model.dto.ImageDto;
import com.emm.yixun.common.model.dto.SalesReportAppDto;
import com.emm.yixun.common.model.dto.SignedCustomerVo;
import com.emm.yixun.common.page.Page;
import com.emm.yixun.common.response.Response;
import com.emm.yixun.common.response.ResponseList;

@WebService
public interface CustomerServiceFacade{
     	/**
	    *新增
	    */
		Response<CustomerDto> save(CustomerDto dto);
		
		public AddCustomerResDto addCustomer(AddCustomerReqDto reqDto,User user)
				throws Exception;
		
		public AddCustomerResDto allAddCustomer(CustomerDto reqDto)
				throws Exception;
		
		public AddCustomerResDto updateCustomer(AddCustomerReqDto reqDto,User user)
				throws Exception;
		
		/**
		*修改,当selective=true时修改非空列,当selective=false修改所有列
		*/
		Response<Integer> updateByPrimaryKey(CustomerDto dto,Boolean selective);
		
		/**
		 *逻辑删除
		 */
		Response<Integer> deleteByPrimaryKey(Long id);
		
		/**
		 *主键查询
		 */
		Response<Customer> findById(Long id);
		
		Response<CustomerInfo> findInfoByIdCN(Long id);
		
		Response<CustomerInfo> findInfoById(Long id);
		
		/**
		 *根据dto查询记录
		 */
		ResponseList<Customer> findByDto(CustomerDto dto);
		
		ResponseList<Project> findProjectByDto(CustomerComponentDto entity);
		/**
		 * 根据DTO查询相关业务
		 * @param dto
		 * @return
		 */
		ResponseList<BusinessRelation> findBusinessByDto(BusinessRelationDto dto);
		/**
		 *根据dto以及分页参数查询记录
		 */
		Page<Customer> findPageByDto(CustomerDto dto,Integer begin,Integer row);
		
		Page<CustomerComponentDto> findCustomerComponentPage(CustomerComponentDto entity, Integer begin, Integer end);
		
		public Page<CustomerComponentDto> findCustomerPage(
				CustomerComponentDto entity, Integer begin, Integer end);
		
		public ResponseList<CustomerComponentDto> selectCustomerAll(CustomerComponentDto entity);
		
		/**
		 * 分配置业顾问
		 * @param reqDto
		 * @return 操作结果
		 */
		public DistributionConsultantResDto distributionConsultant(DistributionConsultantReqDto reqDto);
		
		/**
		 * 新增客户跟进
		 * @param reqDto
		 * @return
		 */
		public AddFollowResDto addFollow(AddFollowReqDto reqDto);
		/**
		 *根据dto以及分页参数查询记录
		 */
		Page<Image> findImagePageByDto(ImageDto dto,Integer begin,Integer row);
		
		/**
		 *根据dto查询记录
		 */
		ResponseList<Customer> selectCustomerPhoneByListPC(CustomerDto dto);
		
		/**
		 * 根据姓名或手机号查询客户
		 * @param entity
		 * @param begin
		 * @param end
		 * @return
		 */
		public Page<CustomerComponentDto> findCustomerPageByNameOrPhone(CustomerComponentDto entity, Integer begin, Integer end, boolean needPermission);


		public Response<Integer> selectCustomerCount(CustomerComponentDto entity);
		
		public ResponseList<Image> selectListByDto(ImageDto dto);

	public ResponseList<Customer> selectCustomerListByDto(CustomerDto dto);
		
		public String queryCustomerBusiness(Long id);
		/**
		*
		* @Title: hotfixCustomerSignedInfo 
		* @Description: 修复客户信息 
		* @param @param list
		* @param @return    设定文件 
		* @return Response<Boolean>    返回类型 
		* @throws
		 */
		public Response<Boolean> hotfixCustomerSignedInfo(List<SignedCustomerVo> list,Long projectId);
		
		

	/**
	 * 查询未完善客户信息的总数  客户列表   欢迎页提醒
	 * @param entity
	 * @return
	 */
	int findIntentionIntactCount(CustomerComponentDto entity);

	/**
	 * 分页查询完善客户信息 客户列表
	 * @param entity
	 * @param begin
	 * @param end
	 * @return
	 */
	Page<CustomerComponentDto> findCustomerIntentionPage(CustomerComponentDto entity, Integer begin, Integer end);
	
	/**
	 * 
	 * queryProjectFtContactWay:客户来电来访统计. <br/>
	 *
	 * @author Administrator
	 * @param startTime
	 * @param endDate
	 * @param oaId
	 * @return
	 * @since JDK 1.6
	 */
	ResponseList<ContactWayDto> queryProjectFtContactWay(String startTime, String endDate,String oaId);
	
	/**
	 * 
	 * queryCustomerLevel:(客户等级统计). <br/>
	 * @author Administrator
	 * @param list
	 * @param startTime
	 * @param endTime
	 * @since JDK 1.6
	 */
	ResponseList<HighchartsDto> queryCustomerLevel(List<ContactWayDto> list,String startTime, String endTime);
	
	/**
	 * queryProjectSignedInfo:(微信销售报表). <br/>
	 * @author Administrator
	 * @param startTime
	 * @param endTime
	 * @return
	 * @since JDK 1.6
	 */
	ResponseList<SalesReportAppDto> queryProjectSignedInfo(String startTime,String endTime,String oaId);

	/**
	 *根据dto查询记录
	 */

	List<String[]> getSubjectRatio(CustomerDto dto, String num);
	
	/**
	 * 
	 * giveUpCustomer:(放弃客户). <br/>
	 * @author Administrator
	 * @param user
	 * @param customerId
	 * @return
	 * @since JDK 1.6
	 */
	Response<Boolean> giveUpCustomer(User user,Long customerId);
	
	/**
	 * 
	 * findGiveUpPage:(已放弃客户列表). <br/>
	 * @author Administrator
	 * @param entity
	 * @param begin
	 * @param end
	 * @return
	 * @since JDK 1.6
	 */
	public Page<CustomerComponentDto> findGiveUpPage(CustomerComponentDto entity, Integer begin, Integer end);
	
	/**
	 * 
	 * getGiveUpCustomer:(认领客户). <br/>
	 * @author Administrator
	 * @param customerId
	 * @return
	 * @since JDK 1.6
	 */
	public Response<Boolean> getGiveUpCustomer(Long customerId,User user);

	/**
	 * 保存电转访
	 * @param customerDto
	 * @return
	 */
	AddContactWayResDto addContactWay(CustomerDto customerDto);


	/**
	 * 检验客户是否存在认购、签约交易
	 * @param customerId
	 * @return
	 */
	boolean checkCustomerLevel(Long customerId);

	/**
	 * 检验客户信息是否已完善
	 * @param customerId
	 * @return
	 */
	boolean checkCustomerPerfect(Long customerId);

	/**
	 * 变更客户等级
	 * @param customerId
	 * @return
	 */
	boolean changeCustomerLevel(Long customerId, String level);

	/**
	 * 客户自动放弃
	 * @return
	 */
	Response<CommonResDTO> customerAutoGiveup(Long projectId);

	void changeCustomerPerfect(Long customerId);
}
